#include<iostream>
using namespace std;

class Solution {
public:
    int sumOfTheDigitsOfHarshadNumber(int x)
    {
        int a = x;
        int count = 0;
        while (a != 0)
        {
            int n = a % 10;
            count += n;
            a /= 10;
        }
        if (x % count == 0)
            return count;
        return -1;
    }
};